let person = { 
    name:'冯总',
    age:18,
    like:{
        sport:'running',
        food:'beef'
    }
}

function deepCopy(obj) {
    var obj2 = obj instanceof Array ? [] : {}
    for (let i in obj) {
        if (obj[i] instanceof Object) {
            console.log(i instanceof Object);
            obj2[i] = deepCopy(i)
        } else{
            obj2[i] = obj[i]
        }
    }
    return obj2
}

let newPerson = deepCopy(person)
person.age.like = 'swimming'
console.log(newPerson);  // { name:'冯总',age:18,like;{sport:'running',food:'food'}}